//index.js
//获取应用实例
const app = getApp()
const host = require('../../config').host

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    lists:"display",
    session:1,
    currentReviewId: 0,
    currentTabId: 0,
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  // 选项卡
    toBankuai: function (event) {
    console.log(event);
    console.log(event.currentTarget.dataset.typeid);
    // var typeTid = event.currentTarget.dataset.typetid;
    var typeId = event.currentTarget.dataset.typeid;
    // app.globalData.typeId = event.currentTarget.dataset.typeid;
    // var functions = event.currentTarget.dataset.function;
    this.setData({
      currentTabId:event.currentTarget.dataset.typeid,
      lists:"",
      schedule:"",
      experts:"",
    });
    if(typeId == "0"){
      this.setData({
        lists:"display",
      });
    }
    if(typeId == "1"){
      // this.dynamicTabss(experts_id);
      this.setData({
        schedule:"display",
      });
    }
    if(typeId == "2"){
      // this.remarkTabss(experts_id);
      this.setData({
        experts:"display",
      });
    }
  },
  // 审核选项卡
    toTables: function (event) {
    console.log(event);
    console.log(event.currentTarget.dataset.typeid);
    // var typeTid = event.currentTarget.dataset.typetid;
    var typeId = event.currentTarget.dataset.typeid;
    // app.globalData.typeId = event.currentTarget.dataset.typeid;
    // var functions = event.currentTarget.dataset.function;
    this.setData({
      currentReviewId:event.currentTarget.dataset.typeid,
    });
  },
  onLoad: function () {
    this.scehdule()
  },
  scehdule: function(){
    var that = this
    wx.request({
      url: host+'api/expertreview/schedule',
      data:{expert_id:app.globalData.id},
      success: function(res){
        that.setData({
          schedule: res.data
        })
      },
      fail: function(data){
        // console.log(data)
      }
    })
  },
  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
